package d0309;

public class Person1 {
        private String name;
        private String address;
        private String sex;
        private int age;
        public Person1() {}
        //四参构造方法
        public Person1(String name, String address, String sex, int age) {
            this.name = name;
            this.address = address;
            this.sex = sex;
            this.age = age;
        }
        //输出方法用于显示四种属性
        public void method() {
            System.out.print(this.name);
            System.out.print(this.address);
            System.out.print(this.sex);
            System.out.println(this.age);

        }
        public static void main(String[] args) {
            //调用六参构造方法 创建student对象
            Student1 student = new Student1("李四，住址：","白城，性别：","男，年龄：",24,0,0);
            //输出六个属性
            student.method();


        }
    }

    //学生类
    class Student1 extends Person1 {
        public int math;
        public int english;
        public Student1(){}
        public Student1(int math, int english) {
            this.math = math;
            this.english = english;
        }
        public Student1(String name, String address, String sex, int age, int math, int english) {
            //调用父类的构造方法属性赋值
            super(name, address, sex, age);
            //为子类属性赋值
            this.math = math;
            this.english = english;
        }
        //重写方法
        public void method() {
            //调用父类的show方法 输出父类的四个属性
            super.method();
            System.out.println("他的数学成绩"+this.math);
            System.out.println("英语成绩"+this.english);
        }



    }

